<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <script src="{{ url_for("static",filename="jquery/jquery.3.6.min.js") }}"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js"
            integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+"
            crossorigin="anonymous"></script>
    <link rel="stylesheet" href="{{ url_for("static",filename="bootstrap/bootstrap.4.6.min.css") }}">
    <link rel="stylesheet" href="{{ url_for('static',filename='css/init.css') }}">
    {% block head %}{% endblock %}
    <title>{% block title %}Flask App{% endblock %}</title>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
    <div class="container">
        <a class="navbar-brand" href="#">知了问答</a>
        <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
                aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
                <li class="nav-item active">
                    <a class="nav-link" href="{{ url_for('qa.index') }}">首页 <span class="sr-only">(current)</span></a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="{{ url_for("qa.public_qa") }}">发布问答</a>
                </li>
                <li class="nav-item ml-2">
                    <form class="form-inline my-2 my-lg-0" method="GET" action="{{ url_for('qa.search') }}">
                        <input class="form-control mr-sm-2" type="search" placeholder="关键字" aria-label="Search"
                               name="keyword">
                        <button class="btn btn-outline-success my-2 my-sm-0" type="submit">搜索</button>
                    </form>
                </li>
            </ul>
            <ul class="navbar-nav">
                {% if current_user %}
                    <li class="nav-item">
                        <ul class="navbar-nav">
                            <li class="nav-item dropdown">
                                <a class="nav-link dropdown-toggle" href="{{ url_for("user.info") }}"
                                   id="navbarDropdown" role="button"
                                   data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                    {{ current_user.username }}
                                </a>
                                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="{{ url_for("user.info") }}">个人中心</a>
                                    <a class="dropdown-item" href="#">修改密码</a>
                                    <a class="dropdown-item" href="#">修改邮箱</a>
                                </div>
                            </li>
                        </ul>


                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for("auth.logout") }}">退出登录</a>
                    </li>
                {% else %}
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for("auth.login") }}">登录</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="{{ url_for("auth.register") }}">注册</a>
                    </li>
                {% endif %}


            </ul>
        </div>

    </div>

</nav>
<div class="container">
    {% block content %}{% endblock %}
</div>
<footer class="footer">
    <div class="container">
        <span class="text-muted">&copy; 2025 by <a href="https://www.baidu.com">百度</a></span>
    </div>
</footer>


</body>
</html>